//
//  ST_ObservableType+Bt.swift
//  btvideo
//
//  Created by Jason on 2021/11/2.
//  Copyright © 2021 JarvanZhang. All rights reserved.
//

import Foundation
import RxSwift
import SwiftyJSON

extension ObservableType where Element == Result<JSON,ST_NetworkError>{
    
    ///包装成带error的 Observable
    func wrap_response_data()->Observable<JSON>{
        
        flatMap { element -> Observable<JSON> in
            switch element {
            case .success(let t):
                return Observable.just(t)
            case .failure(let error):
                return Observable.error(error)
            }
        }
    }
}
